#!/usr/bin/env python

import yaml
import pprint
import os, sys
from optparse import OptionParser

class Config(object):
    def __init__(self, filename):
        self.config = yaml.load(file(filename, "rb").read())

DESC = """
Kitsune is a program to 'tail -f' multiple log files at one time.
"""

def main():
    parser = OptionParser(usage="%prog [options]", version="%prog 0.1", description=DESC)
    parser.add_option("-f", "--file", dest="config_file", metavar="FILE",
                       help="Define a configuration file to use")
    parser.add_option("-d", "--debug", dest="debug", action="store_true",
                       help="Turn on debugging")
    
    (opts, args) = parser.parse_args()
    
    if opts.config_file:
        config_file = opts.config_file
    else:
        config_file = os.path.expanduser("~/.kitsunerc")
               
#    try:
    c = Config(config_file)
#    except:
      #  sys.exit("Error: Unable to open configuration file %s" % (config_file));
        
    

    pp = pprint.PrettyPrinter(indent=2)
    pp.pprint(c.config)
    
    for tail in c.config["files"]:
        try:
            # Filename has options under it so it's a key in a Dict
            filename =  tail.keys()[0]
            opts = 
        except AttributeError:
            # Filename has no options
            filename = tail
        
        print filename


        

if __name__ == '__main__':
    main()
        


